Carlos Garnacho [Thu, 19 Mar 2015 14:58:00 +0000 (15:58 +0100)]
wayland: Silence warnings on clipboard data sending cancellation
During copy/paste, it may be common that we receive several property changes
around the selection atom, this results in warnings when cancelling the previous
write attempt. We already honor the last request properly, so we should just
cancel silently.
Carlos Garnacho [Thu, 19 Mar 2015 14:54:48 +0000 (15:54 +0100)]
wayland: Ensure we re-request the target if the fd changes
If we receive wl_data_source.target before .send, the target would already
be cached, but we'd take no action on the new fd.
Carlos Garnacho [Thu, 19 Mar 2015 14:49:04 +0000 (15:49 +0100)]
wayland: Don't accept the "TARGETS" target on the wl_data_offer
This is handled separately through the data already cached from the
wl_data_offer.offer handler, we can avoid this request entirely then.
Милош Поповић [Thu, 19 Mar 2015 13:20:12 +0000 (13:20 +0000)]
Updated Serbian translation
Benjamin Otte [Thu, 19 Mar 2015 02:54:38 +0000 (03:54 +0100)]
Adwaita: Fix context menu shadows not showing up
Bastien Nocera [Wed, 18 Mar 2015 10:44:40 +0000 (11:44 +0100)]
inspector: Make it easier to cut'n'paste advice message
The message says "Enable statistics with GOBJECT_DEBUG=instance-count"
but the message itself isn't selectable, making it hard to cut'n'paste.
https://bugzilla.gnome.org/show_bug.cgi?id=746391
Benjamin Otte [Wed, 18 Mar 2015 17:22:17 +0000 (18:22 +0100)]
csspathnode: Handle context going away
Sometimes path nodes can survive longer than the style context that
created them. Don't crash in those cases.
Fixes startup of mutter.
Testcase included.
https://bugzilla.gnome.org/show_bug.cgi?id=746407
Benjamin Otte [Mon, 2 Mar 2015 23:02:25 +0000 (00:02 +0100)]
inspector: Add a new page that lists the CSS node tree
Benjamin Otte [Thu, 5 Mar 2015 19:29:37 +0000 (20:29 +0100)]
cssnode: Add properties
Benjamin Otte [Thu, 5 Mar 2015 16:51:23 +0000 (17:51 +0100)]
csswidgetnode: Use style_changed signal instead of update_style vfunc
Benjamin Otte [Thu, 5 Mar 2015 16:35:57 +0000 (17:35 +0100)]
cssnode: Add a style-changed signal
The signal gets emitted whenever the style needs to be changed.
Benjamin Otte [Sun, 1 Mar 2015 20:33:54 +0000 (21:33 +0100)]
cssnode: Add node-added and node-removed signal
This allows monitoring the CSS tree. For now, moving a child to a
different position relative to its siblings while keeping the same
parent will cause a child-added + child-removed emission.
Benjamin Otte [Sun, 1 Mar 2015 12:14:01 +0000 (13:14 +0100)]
cssnode: Track invalid children
We need to properly track if a node needs to propagate invalidation
state information to its children. We didn't do this properly before and
that could lead to us forgetting to invalidate nodes in corner cases.
Benjamin Otte [Thu, 5 Mar 2015 05:23:35 +0000 (06:23 +0100)]
csswidgetnode: Avoid creating a stylecontext
If the widget doesn't have a style context, don't create one. Instead,
call functions on the widget directly.
Benjamin Otte [Sat, 28 Feb 2015 01:22:38 +0000 (02:22 +0100)]
cssnode: Change the way we invalidate timestamps
Do not propagate the TIMESTAMP change through the node tree, as that
causes lots of uneeded markings of nodes as invalid.
Instead, walk the node tree and find the nodes that have a non-static
style and only invalidate timestamps on those.
Benjamin Otte [Fri, 27 Feb 2015 17:41:13 +0000 (18:41 +0100)]
cssstyle: Add gtk_css_style_is_static()
Gets rid of the need to do
if (ANIMATED_STYLE() &&
animated_style_is_static(ANIMATED_STYLE(style))
Benjamin Otte [Wed, 25 Feb 2015 17:25:01 +0000 (18:25 +0100)]
cssnode: Special-case TIMESTAMP invalidations
Only invalidate timestamps if the node is marked as invalid. We overload
the meaning of "invalid" as "tracks timestamps".
While I don't like the way this is written, it is an important
optimization because 95+% of nodes don't animate so timestamps don't
matter to them. But timestamps are invalidated 60x per second.
Benjamin Otte [Wed, 25 Feb 2015 17:05:07 +0000 (18:05 +0100)]
cssnode: Redo style changed tracking
We don't return a NULL style to mean "no changes" anymore, instead
we check new_style == old_style to mean that.
Make sure the code reflects this, otherwise we'll send
GTK_CSS_CHANGE_PARENT_STYLE invalidations everywhere and screw up
performance.
Benjamin Otte [Mon, 23 Feb 2015 02:06:02 +0000 (03:06 +0100)]
stylecontext: Call get_style(), not create_style()
We want to ensure that the style is created properly.
This also allows making the create_Style() function private.
Benjamin Otte [Sun, 22 Feb 2015 22:28:04 +0000 (23:28 +0100)]
cssnode: Merge the 2 places that compute styles
Now that the widget node recomputes styles on update_style() we can just
call it during validate(). That way, we don't need the widget node to
manually compute its style.
Benjamin Otte [Sun, 22 Feb 2015 22:11:22 +0000 (23:11 +0100)]
cssnode: Always return correct style values
If CSS values are queried from a widget, recompute them if necessary. Do
not emit style-updated until the validation phase however.
This way, we don't run into performance traps when style-update causes
invalidations that cause new style-updated to be emitted.
Benjamin Otte [Sun, 22 Feb 2015 17:04:43 +0000 (18:04 +0100)]
cssstyle: Add optimization
There is no difference between a style and itself.
Benjamin Otte [Sun, 22 Feb 2015 07:26:29 +0000 (08:26 +0100)]
stylecontext: Refactor gtk_style_context_invalidate()
There's no need anymore to recreate styles, nodes do that automagically
now.
This allows making gtk_css_node_set_style() private.
Benjamin Otte [Sun, 22 Feb 2015 07:23:04 +0000 (08:23 +0100)]
cssnode: Create animated styles by default
... and hardcode transient and path nodes to never create animated
styles.
Benjamin Otte [Sun, 22 Feb 2015 05:19:33 +0000 (06:19 +0100)]
cssnode: Add optimization
Don't even try to propagate changes when we know there are none.
Benjamin Otte [Sat, 21 Feb 2015 02:40:46 +0000 (03:40 +0100)]
cssnode: Change the way we start animations
We now have a flag for "invalidate animations", use that to restart
animations and decide if we want to start transitions.
Benjamin Otte [Fri, 20 Feb 2015 23:16:58 +0000 (00:16 +0100)]
cssnode: Return NULL as frame clock when animations are disabled
This is a crude hack, but it works.
FIXME: Hook it up to the GtkSettings so that we properly update when the
setting changes.
Benjamin Otte [Fri, 20 Feb 2015 23:15:04 +0000 (00:15 +0100)]
cssstyle: Handle 0 timestamp to mean "don't animate"
Benjamin Otte [Fri, 20 Feb 2015 16:36:10 +0000 (17:36 +0100)]
cssnode: Move style context function to only user
Benjamin Otte [Fri, 20 Feb 2015 16:28:23 +0000 (17:28 +0100)]
cssnode: Remove timestamp from gtk_css_node_validate()
GtkCssNode knows its own timestamp.
Benjamin Otte [Wed, 18 Feb 2015 23:54:14 +0000 (00:54 +0100)]
cssnode: Add API to query the timestamp
... and pass it to the API that computes new styles.
A special timestamp of 0 means "please don't animate" and is used when
no frame clock is available for a node.
Benjamin Otte [Wed, 18 Feb 2015 05:01:41 +0000 (06:01 +0100)]
cssnode: Make parent style change part of GtkCssNode
Benjamin Otte [Wed, 18 Feb 2015 04:55:38 +0000 (05:55 +0100)]
cssnode: Propagate pending changes after recomputing new style
This way we can propagate if the new style actually changed anything.
Benjamin Otte [Tue, 17 Feb 2015 15:11:38 +0000 (16:11 +0100)]
cssnode: Add gtk_css_node_invalidate_style_provider()
This function not just invalidates the current node, but also all
children.
Benjamin Otte [Tue, 17 Feb 2015 14:18:32 +0000 (15:18 +0100)]
cssnode: Change get_style_provider() vfunc
Instead of always returning a provider, allow the vfunc to return NULL
to mane "use same provider as parent". This allows a bunch of
optimizations.
Benjamin Otte [Tue, 17 Feb 2015 04:01:09 +0000 (05:01 +0100)]
cssnode: Implement a way to properly track invalidations
See the comment in gtkcssnodeprivate.h for how this works.
Benjamin Otte [Sat, 14 Feb 2015 05:45:21 +0000 (06:45 +0100)]
cssnode: Change vfunc
This is mainly an attempt to merge the update_style() and validte()
vfuncs. Code is not there yet, but that's the idea.
Also, gtk_css_node_set_style() should not be public. And this gets
closer to that goal, too.
Benjamin Otte [Sat, 14 Feb 2015 05:40:00 +0000 (06:40 +0100)]
cssnode: Only pass a boolean for parent changes
Nobody cares what changed in the parent, so don't track it.
Benjamin Otte [Sat, 14 Feb 2015 01:27:39 +0000 (02:27 +0100)]
cssvalue: Remove GtkCssDependencies
They are not used anymore.
Benjamin Otte [Sat, 14 Feb 2015 00:59:17 +0000 (01:59 +0100)]
cssstyle: Remove unused optimization
After measuring it, I realized the optimization never triggers for
Adwaita and rarely ever triggers for simple themes. So it is not
useful to keep it around.
Benjamin Otte [Fri, 13 Feb 2015 21:04:26 +0000 (22:04 +0100)]
csswidgetnode: Always return a valid style
Benjamin Otte [Fri, 13 Feb 2015 21:00:06 +0000 (22:00 +0100)]
csspathnode: Call gtk_style_context_validate()
Don't call gtk_style_context_invalidate(), that function does too much
work.
Benjamin Otte [Fri, 13 Feb 2015 20:21:46 +0000 (21:21 +0100)]
testsuite: Add another random stylecontext test
Benjamin Otte [Fri, 13 Feb 2015 18:57:55 +0000 (19:57 +0100)]
cssnode: Use the frame clock's time
... nstead of the monotonic time when validating a cssnode.
Benjamin Otte [Fri, 13 Feb 2015 11:44:04 +0000 (12:44 +0100)]
cssnode: Treat transient nodes as invisible nodes
Making transient nodes invisible allows us to remove special cases
without any bad side effects and they continue working just like they
did before.
Benjamin Otte [Tue, 10 Feb 2015 01:53:28 +0000 (02:53 +0100)]
reftests: Add a reftest for box sibling ordering
Benjamin Otte [Tue, 10 Feb 2015 01:50:57 +0000 (02:50 +0100)]
cssnode: Add visibility concept
This allows hiding nodes of invisible widgets.
And that in turn makes sure :nth-child() works as expected.
Benjamin Otte [Mon, 9 Feb 2015 21:51:28 +0000 (22:51 +0100)]
box: Use CSS nodes instead of widget paths
This is a very simple patch that causes a bunch of overhead. But it
works.
Benjamin Otte [Mon, 9 Feb 2015 21:27:44 +0000 (22:27 +0100)]
widget: Add gtk_widget_get_css_node()
and replace gtk_style_context_get_root() with it.
Benjamin Otte [Mon, 9 Feb 2015 21:03:13 +0000 (22:03 +0100)]
cssnode: Refactor node tree modification code
This allows adding more API for it.
It also includes code that tracks modifications and invalidates siblings
and their positions whenever nodes get added or removed.
Benjamin Otte [Mon, 9 Feb 2015 17:38:57 +0000 (18:38 +0100)]
cssnode: Add hackery to allow bypassing widget paths
If we know the parent's get_path_for_child() implementation is safe to
be used with GtkCssNode because it doesn't do anything special, we do
that. Unfortunately that requires whitelisting vfuncs because the vfunc
is public API so anyone can override it.
Benjamin Otte [Mon, 9 Feb 2015 16:26:07 +0000 (17:26 +0100)]
cssnode: Remove now unused arg from vfunc
Benjamin Otte [Mon, 9 Feb 2015 15:41:06 +0000 (16:41 +0100)]
cssnode: Add a matcher for nodes
... and use that matcher by default - ie for transient nodes.
Benjamin Otte [Mon, 9 Feb 2015 15:14:03 +0000 (16:14 +0100)]
cssnode: Make widget node not copy the path
Instead, use gtk_widget_get_path() which makes GtkWidget cache the path.
This is a temporary solution until we can get rid of widget paths.
This increases memory usage quite noticably.
Benjamin Otte [Mon, 9 Feb 2015 14:21:48 +0000 (15:21 +0100)]
cssnode: Make widget node use new matcher
Benjamin Otte [Mon, 9 Feb 2015 10:29:48 +0000 (11:29 +0100)]
cssnode: Make path node create matcher without copying
... the WidgetPath. This uses the functionality introduced in the
previous commits.
Benjamin Otte [Mon, 9 Feb 2015 10:24:29 +0000 (11:24 +0100)]
cssmatcher: Allow widget path matcher to take a node declaration
The node declaration has the same functionality as
gtk_css_node_declaration_add_to_widget_path(). So instead of using that
function on a path, you can use the original path and the declaration in
a matcher.
Benjamin Otte [Mon, 9 Feb 2015 08:41:48 +0000 (09:41 +0100)]
cssnode: Split out a function
So far the vfunc is kinda quirky (the path argument is an out argument
for something you have to free when you're done with the matcher), but
I'm about to change that.
Benjamin Otte [Sun, 15 Feb 2015 21:26:13 +0000 (22:26 +0100)]
widget: Create widget path classes from proper style
We don't want to add the current classes to the widget path - which
might potentially be different after a gtk_style_context_save() - but
the root node's ones. So what better thing to do than actually using the
root node?
Benjamin Otte [Sun, 8 Feb 2015 15:44:11 +0000 (16:44 +0100)]
widget: Use correct type for widgetpath creation
This is relevant when the widget path is created while the widget is
still constructing. G_OBJECT_TYPE(widget) might not point to the final
type yet.
Benjamin Otte [Sun, 8 Feb 2015 15:37:08 +0000 (16:37 +0100)]
widget: Create the CssNode
... and pass it to the style context instead of having the style context
create it for us.
Benjamin Otte [Sun, 8 Feb 2015 11:15:27 +0000 (12:15 +0100)]
cssnode: Refactor invalidation propagation
We want to be sure to gtk_css_node_invalidate() all potential changes.
Benjamin Otte [Sat, 7 Feb 2015 18:03:37 +0000 (19:03 +0100)]
stylecontext: Don't queue animate tick callbacks anymore
Instead, just mark nodes permanently as invalid.
Benjamin Otte [Sat, 7 Feb 2015 17:53:07 +0000 (18:53 +0100)]
cssnode: Handle invalidate queueing differently
Instead of directly requesting the layout phase, register a tick
callback. This is what the docs suggest for animations and it's what we
need for the next commit.
Benjamin Otte [Sat, 7 Feb 2015 16:19:07 +0000 (17:19 +0100)]
cssnode: Change way invalidation is handled
Have a queue_validate() vfunc and a dequeue_validate() vfunc that are
called only on root nodes so they can queue a validation on their frame
clocks.
Benjamin Otte [Sat, 7 Feb 2015 09:30:27 +0000 (10:30 +0100)]
cssnode: Refactor gtk_css_widget_node_validate()
Makes it clearer what actually happens in that function.
Benjamin Otte [Thu, 5 Feb 2015 05:49:59 +0000 (06:49 +0100)]
cssnode: Only recreate styles when needed
Benjamin Otte [Wed, 4 Feb 2015 03:43:55 +0000 (04:43 +0100)]
cssnode: Automatically recreate style on get_style() call
When the style is invalid, redo it.
Make this a vfunc, so the widget nodes can opt out.
Benjamin Otte [Tue, 3 Feb 2015 14:36:01 +0000 (15:36 +0100)]
cssnode: Track pending changes here
... instead of GtkCssWidgetNode.
Benjamin Otte [Mon, 2 Feb 2015 14:35:08 +0000 (15:35 +0100)]
stylecontext: Move gtk_style_context_validate() to GtkCssWidgetNode
Benjamin Otte [Mon, 2 Feb 2015 14:34:32 +0000 (15:34 +0100)]
stylecontext: Move style creation functions to CssNode code
Benjamin Otte [Sun, 1 Feb 2015 15:43:58 +0000 (16:43 +0100)]
stylecontext: Redo handling of differing state
Instead of passing an "override_state" flag, create a new CssNode just
for this simple lookup.
Benjamin Otte [Sun, 1 Feb 2015 06:33:40 +0000 (07:33 +0100)]
stylecontext: Get rid of stylecontext argument
... to a bunch of functions.
This requires a tiny change to the heuristics for the style cache - we
now cache styles when they have the same style provider as their parent
instead of when they have the default provider - but that change doesn't
have any effect in practice.
Benjamin Otte [Sat, 31 Jan 2015 15:30:05 +0000 (16:30 +0100)]
cssnode: Add gtk_style_context_get_style_provider()
... and use it when looking up properties.
Benjamin Otte [Fri, 30 Jan 2015 15:28:41 +0000 (16:28 +0100)]
stylecontext: Remove children list
It's not needed.
Benjamin Otte [Fri, 30 Jan 2015 15:27:17 +0000 (16:27 +0100)]
stylecontext: Move validation into GtkCssNode
Benjamin Otte [Fri, 30 Jan 2015 10:42:22 +0000 (11:42 +0100)]
stylecontext: Export gtk_style_context_get_root()
.. in the private header. This avoids tiny wrapper functions.
Benjamin Otte [Wed, 28 Jan 2015 04:14:47 +0000 (05:14 +0100)]
cssnode: Track invalid flag
Remove it from GtkStyleContext.
Benjamin Otte [Mon, 26 Jan 2015 05:13:01 +0000 (06:13 +0100)]
cssnode: Implement refcounting
The parent refs the child, so gtk_css_node_set_parent() adds/removes a
reference.
We should probably refactor this so that we name the function
parent.add(node) instead of node.set_parent(parent) - makes the
refcounting more clear.
Benjamin Otte [Mon, 26 Jan 2015 01:18:06 +0000 (02:18 +0100)]
stylecontext: Handle parent in CssNode code
Make CssNode a real tree with a DOM-like API.
Benjamin Otte [Sun, 25 Jan 2015 05:14:48 +0000 (06:14 +0100)]
stylecontext: Move relevant_changes tracking to GtkCssWidgetNode
Benjamin Otte [Sun, 25 Jan 2015 01:40:40 +0000 (02:40 +0100)]
cssnode: Handle invalidation
Handle invalidation of node inside the CssNode code, don't do it in the
stylecontext.
Benjamin Otte [Sat, 24 Jan 2015 19:57:17 +0000 (20:57 +0100)]
stylecontext: Get rid of create_query_path()
Move that functionality into GtkCssNode.
Benjamin Otte [Sat, 24 Jan 2015 19:52:34 +0000 (20:52 +0100)]
stylecontext: Change arguments for build_properties
Instead of passing the style declaration, take the node's style
declaration. Add arguments to allow overriding the state for the one
case where this didn't work.
Benjamin Otte [Sat, 24 Jan 2015 19:05:33 +0000 (20:05 +0100)]
stylecontext: Compute rootness of CssNode
.. instead of passing it as an argument.
Benjamin Otte [Sat, 24 Jan 2015 18:51:05 +0000 (19:51 +0100)]
stylecontext: Pass cssnode to build_properties
Benjamin Otte [Sat, 24 Jan 2015 18:44:47 +0000 (19:44 +0100)]
stylecontext: Simplify a function
Benjamin Otte [Sat, 24 Jan 2015 17:55:54 +0000 (18:55 +0100)]
stylecontext: Remove values cache
The code is confusing the stylecontext=>node transition, so I'll remove
it.
WIth the recent introduction of the parent style cachen, I'm not sure
it's worth it at all. Some crude benchmarking suggests a slight speedup
when removing the cache.
So no guarantees about adding it back later.
Benjamin Otte [Mon, 12 Jan 2015 02:58:21 +0000 (03:58 +0100)]
cssnode: Split into 3 objects
- GtkCssWidgetNode
for style contexts owned by a widget
- GtkCssPathNode
for style contexts using a GtkWidgetPath
- GtkCssTransientNode
for nodes created with gtk_style_context_save()/restore()
Benjamin Otte [Sat, 10 Jan 2015 22:49:04 +0000 (23:49 +0100)]
cssnode: Turn into a GObject
This will allow us to use subclasses.
Benjamin Otte [Sat, 10 Jan 2015 21:35:38 +0000 (22:35 +0100)]
stylecontext: Turn CssNode accesses into getters/setters
That way we can hide the struct in the source file.
Benjamin Otte [Fri, 9 Jan 2015 23:47:32 +0000 (00:47 +0100)]
stylecontext: Split out GtkCssNode into own file
The functionality of it is supposed to grow, so better put it in a
custom file early.
This is just a naive split so far, the next patches will split things
further.
Benjamin Otte [Wed, 18 Mar 2015 14:22:09 +0000 (15:22 +0100)]
render: Make image effect not depend on state
Instead rely on -gtk-image-effect only. Adwaita should already work this
way.
Relying on state was a leftover feature from the GTK 2 days.
Benjamin Otte [Tue, 17 Mar 2015 15:45:05 +0000 (16:45 +0100)]
notebook: Protect against invalid allocations
A widget can be mapped but not have a size allocated yet. In that case
avoid computing a broken rectangle.
https://bugzilla.gnome.org/show_bug.cgi?id=746301
Carlos Garnacho [Tue, 17 Mar 2015 16:59:15 +0000 (17:59 +0100)]
wayland: Fix thinko in wl_data_source.cancelled handler
The wl_data_source may be the clipboard's. Looking up the drag context in
order to get the display isn't going to fare well there. So, just use the
default display, and only look up the drag context when we know we need it.
https://bugzilla.gnome.org/show_bug.cgi?id=746386
Christian Hergert [Tue, 10 Feb 2015 00:41:48 +0000 (16:41 -0800)]
textview: add support for underline and strikethrough colors
This commit adds the GtkTextTag:underline-rgba and :strikethrough-rgba
properties and the necessary plumbing to apply these colors in GtkTextLayout.
With this change, you can alter the color of underlines including those
of type PANGO_UNDERLINE_ERROR.
You might want to alter the underline color to differentiate between
spelling and grammer mistakes. In code editors, it is convenient to
differentiate between errors and warnings.
Note that the GtkTextAppearance struct is public ABI and has no spare
room for new fields, so we are resorting to some tricky packing to store
the colors in the unused pixel field of the fg_color and bg_color structs.
This packing is accomplished by the macros in gtktextattributesprivate.h.
Signed-off-by: Christian Hergert <christian@hergert.me>
https://bugzilla.gnome.org/show_bug.cgi?id=402168
Matthias Clasen [Wed, 18 Mar 2015 02:02:35 +0000 (22:02 -0400)]
GtkRange: Fix scroll wheel direction for horizontal ranges
The expected behavior here is that scrolling up goes towards
larger values, ie to the right. This matches e.g. volume
sliders in gnome-shell.
https://bugzilla.gnome.org/show_bug.cgi?id=737175
Matthias Clasen [Tue, 17 Mar 2015 12:54:45 +0000 (08:54 -0400)]
scrolled window: Use shift to modify scroll direction
It has been a long-standing request to interpret scroll events
with Shift held down as horizontal instead of vertical, and
some applications are already doing this on their own.
https://bugzilla.gnome.org/show_bug.cgi?id=132197
Matthias Clasen [Tue, 17 Mar 2015 23:38:18 +0000 (19:38 -0400)]
HighContrast: Fix calendar selection
The selected day was not differentiated from other
days at all. Render it white on black instead.
https://bugzilla.gnome.org/show_bug.cgi?id=746369
Matthias Clasen [Tue, 17 Mar 2015 23:34:15 +0000 (19:34 -0400)]
HighContrast: Fix color chooser marks
The checkmark for the selected color was always black,
making it more or less invisible on dark colors.
https://bugzilla.gnome.org/show_bug.cgi?id=746368